﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace UwaySoft.EsheetServer.Help.Response
{
    public class HandleInfoResponse : IResponse
    {
        public HandleInfoResponse(bool success, string serialInfoNo)
        {
            Success = success;
            SerialInfoNo = serialInfoNo;
        }

        public bool Success { get; private set; }

        public string SerialInfoNo { get; private set; }

        public string Remark { get; set; }

        public override string ToString()
        {
            return this.ToString();
        }

        string IResponse.ToString()
        {
            StringBuilder bldr = new StringBuilder();
            bldr.Append("<?xml version=\"1.0\" encoding=\"gb2312\"?>");
            bldr.Append("<returnInfo>");
            bldr.AppendFormat("<returnNo>{0}</returnNo>", Success ? 0 : -1);
            bldr.AppendFormat("<serialInfoNo>{0}</serialInfoNo>", SerialInfoNo);
            bldr.AppendFormat("<remark>{0}</remark>", Remark == null ? string.Empty : Remark);
            bldr.Append("</returnInfo>");
            return bldr.ToString();
        }
    }
}
